package com.example.moilapp;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import com.example.moilapp.adapter.Moil_Pending_Task_Adapter;
import com.example.moilapp.service.Moil_Pendingtask_Service;

import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ExpandableListView;
import android.widget.ExpandableListView.OnChildClickListener;
import android.widget.ExpandableListView.OnGroupClickListener;
import android.widget.Toast;
import android.os.Build;

public class Moil_Pending_Tasks extends ActionBarActivity {
	
	Moil_Pending_Task_Adapter listAdapter;
    ExpandableListView expListView;
    List<String> listDataHeader = new ArrayList<String>();
    HashMap<String, List<String>> listDataChild = new HashMap<String, List<String>>();

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.moil_pending_tasks);
		
		Bundle extras = getIntent().getExtras();
		if (extras != null) {
		    String uid = extras.getString("uid");
		    
		    Button btnlogoout = (Button) findViewById(R.id.btn_logout);
			btnlogoout.setOnClickListener(new OnClickListener() {
				
				@Override
				public void onClick(View v) {
					onBackPressed();
					
				}
			});
		    
		    Moil_Pendingtask_Service mps = new Moil_Pendingtask_Service(Moil_Pending_Tasks.this,""+uid);
			mps.execute(new String[] {"http://t2a1.cloudapp.net/TrafficWorkflow/TraficWorkflowWebService.asmx"});

		}
 
		//prepareListData();
		
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {

		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}
	
	private void prepareListData() {
		
        listDataHeader = new ArrayList<String>();
        listDataChild = new HashMap<String, List<String>>();
 
        // Adding child data
        listDataHeader.add("19 May 2014");
        listDataHeader.add("18 May 2014");
        listDataHeader.add("17 May 2014");
 
        // Adding child data
        List<String> top250 = new ArrayList<String>();
        top250.add("4-MCIS Logistics : \"B.KANTHAN\"");
 
        List<String> nowShowing = new ArrayList<String>();
        nowShowing.add("4-MCIS Logistics : \"A.LAVENDER\"");
 
        List<String> comingSoon = new ArrayList<String>();
        comingSoon.add("4-MCIS Logistics : \"B.ALGAMANDA\"");
        comingSoon.add("4-MCIS Logistics : \"MANTA BHUM\"");
 
        listDataChild.put(listDataHeader.get(0), top250); // Header, Child data
        listDataChild.put(listDataHeader.get(1), nowShowing);
        listDataChild.put(listDataHeader.get(2), comingSoon);
    }

}
